﻿using System;
using System.Collections.Generic;
using System.Web;
using System.Reflection;
using MyDMS.DAL;

/// <summary>
/// Summary description for InboxMessage
/// </summary>
public class InboxMessage : UserMessage
{
    private string _subject = "";
    public string Message_Subject
    {
        get { return _subject; }
        set { _subject = value; }
    }

    public InboxMessage(UserMessage m)
    {
        Type sourceType = m.GetType();
        Type destinationType = this.GetType();

        foreach (PropertyInfo sourceProperty in sourceType.GetProperties())
        {
            PropertyInfo destinationProperty = destinationType.GetProperty(sourceProperty.Name);
            if (destinationProperty != null && destinationProperty.CanWrite)
            {
                destinationProperty.SetValue(this, sourceProperty.GetValue(m, null), null);
            }
        }
    }
}
